<?php
 session_start();
 include("include/session.php");
 include("include/common.php");
 include("include/db.php");

 $sqlEmployeeMonth = mysql_query("SELECT * FROM software_employe_month LIMIT 1");
 $resEmployeeMonth = mysql_fetch_array($sqlEmployeeMonth);
 $employeeMonthImage    = $resEmployeeMonth["employee_image"];
 $employee_comments     = $resEmployeeMonth["employee_comments"];

 if(isset($_REQUEST) && $_REQUEST['submit'] != ''){
 	
	$nameImageProfie		 = time().'_'.$_FILES['employee_image']['name'];
	$image_profile 	 		 = upLoadPic1($_FILES['employee_image'],$nameImageProfie);
	
	if($_FILES['employee_image']['name'] !=  '')
	{
	
	 	$contactUs = "UPDATE software_employe_month
									SET
										employee_image			=	'".$nameImageProfie."',
										employee_comments 		=	'".mysql_real_escape_string($_REQUEST['employee_comments'])."',
										time_id     = unix_timestamp()
										";
	
		mysql_query($contactUs);
		header("location:employee_month.php?msg=1");
		
	}else{
		header("location:employee_month.php?msg=2");
	}
	
	exit();		
 }

 ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?=TITLE_WEBSITE?></title>
<link href="css/c_energy.css" rel="stylesheet" type="text/css" />
<link href="css/logo.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="css/datepicker.css" type="text/css" />
<link rel="stylesheet" media="screen" type="text/css" href="css/layout.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/datepicker.js"></script>
<script type="text/javascript" src="js/eye.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/layout.js?ver=1.0.2"></script>
<script type="text/javascript">
</script>
<style type="text/css">
<!--
.style4 {
	font-size: 22px;
	font-weight: bold;
}
.style6 {color: #999999}
-->
</style>
</head>
<script >
function validation(){
	
	var message = '';

	if(document.getElementById("headline_heading").value == ""){
		message += 'Please enter your heading\n';
	}
	if(document.getElementById("headline_desc").value == ""){
		message += 'Please enter your heading description\n';
	}
	if(message != ""){
		alert(message);
		return false;
	}
	
	
}
</script>
<body>

    <table width="990" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td colspan="3" align="left" valign="top" ><? require("header.php");?></td>
</tr>
  <tr>
    <td align="center" >
	<table width="99%" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="3" align="center" valign="top">&nbsp;</td>
      </tr>
       <tr bgcolor="#FAFAFA">
        <td colspan="0" align="left" valign="top" >
		   <table width="96%" cellspacing="0" cellpadding="0">
		    <tr>
		      <td width="2%" align="left" valign="top" style="padding-left:15px" ><? require("left.php");?></td>
		      <td width="94%"  valign="top" style="padding-left:15px" >
			  <form name="signform" action="" method="post" enctype="multipart/form-data" id="signform" >
			    <table id="signInTbl" width="719" cellspacing="0" cellpadding="0" style="border:solid #cccccc 1px">
                  <tr>
                    <td colspan="2" align="left" bgcolor="#373737" class="loc_search_found_term"  style="border-bottom:solid #cccccc 1px"> Employee of the Month</td>
                  </tr>
                  <?php
                  	if($_REQUEST['msg'] == 1)
					{
				  ?>
                  <tr style="background: #D5FFD5 " height="25">
                 	<td colspan="2"><div align="left" class="successMsg" id="err_site" style="display:block">
                       &nbsp; <strong><?=($_REQUEST['msg'] == 1 ? 'Employee of the month successfully' : 'Sorry,record does not inserted.')?></strong>
                    </div></td>
                  </tr>
                  <?php
                  	}elseif($_REQUEST['msg'] == 2)
					{
				  ?>
                  <tr style="background: #FFE9E9 " height="25">
                 	<td colspan="2"><div align="left" class="ErrorMsg" id="err_site" style="display:block">
                       &nbsp; <strong><?=($_REQUEST['msg'] == 1 ? 'Heading inserted successfully' : 'Sorry,record does not inserted.')?></strong>
                    </div></td>
                  </tr>	
				  <?php		
					}
				  ?>
                  <tr height="50" style="width:80%; height:40px;" id="bannerImage">
                    <td width="249" align="left" style="padding-left:15px">Employee  Image</td>
                    <td width="466" align="left">
                     	<input type="file" id="employee_image" name="employee_image"  style="width:220px"   />
                      </td>
                  </tr>
                 <tr height="50" style="width:80%; height:40px;" id="bannerText">
                   <td width="249" align="left" style="padding-left:15px">Comments</td>
                   <td width="466" align="left">
                     	<textarea id="employee_comments" name="employee_comments" class="textarea" rows="10" cols="40" ><?=$employee_comments?></textarea>
                   </td>
                 </tr>
                 
                   <tr  height="30">
                    <td width="249"  style="padding-left:15px" colspan="2" align="center"><input class="cls_button" type="submit" id="submit" name="submit" value="Submit"  /></td>
                  </tr>
                  <tr>
                  	<td style="width:100%" align="center" colspan="3">
                    	<img src="upload_images/<?=$employeeMonthImage?>" width="150"  /></td>
                    
                  </tr>
                   <tr>
                  	<td style="width:100%" align="center" colspan="3">&nbsp;</td>
                   
                  </tr>
                </table>
			    <ul class="site_nav_menu_buttons">
			      <li class="no_menu_li"><span><a href="main.php">&nbsp;Back to Main </a></span></li>
			      </ul>
			    <p>&nbsp;</p>
			  </form>			  </td>
            </tr>
	        </table></td>
        </tr>
      <tr bgcolor="#FAFAFA">
        <td width="800" align="center" valign="top">&nbsp;</td>
        <td width="100" colspan="2">&nbsp;</td>
      </tr>
	    <tr bgcolor="#FAFAFA">
        <td width="800" align="center" valign="top">&nbsp;</td>
        <td colspan="2">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
</html>

'